<!DOCTYPE html>
<#assign ctx=Session.basePath>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>服务信息</title>
    <script>
        var shipid = '<#if shipid??>${shipid}<#else></#if>';
        var company =  '<#if company??>${company}<#else></#if>';
    </script>
    <link href="${ctx}/easyui/themes/bootstrap/easyui.css" rel="stylesheet" />
    <link href="${ctx}/easyui/themes/icon.css" rel="stylesheet" />
    <link href="${ctx}/inspiniain/font-awesome/css/font-awesome.css" rel="stylesheet">
    <script src="${ctx}/js/jquery-1.12.2.min.js"></script>
    <script src="${ctx}/lib/jquery.form.js"></script>
    <script src="${ctx}/easyui/jquery.easyui.min.js"></script>
    <script src="${ctx}/easyui/locale/easyui-lang-zh_CN.js"></script>
    <script src="${ctx}/pagination/js/layer/layer.js"></script>
<#--<script src="${ctx}/map/js/ol2/Olinit.js"></script>-->

</head>
<body>

<div id="tb" style="padding:5px;height:auto">
    <div>
        关键字:<input id="title" class="easyui-text" style="width: 100px">
        <a href="#" class="easyui-linkbutton btn-search" iconCls="icon-search" style="width: 70px;">查找</a>
    </div>
</div>

<table id="dg"
       data-options="rownumbers:true,singleSelect:true,pagination:true,url:'${ctx}/manage/map/server/ajax/shipServer/page/list',method:'post',toolbar:'#tb',nowrap:false">
    <thead>
    <tr>
        <th data-options="field:'navigate',width:70">船名</th>
        <#--<th data-options="field:'shipimei',width:120">IMEI</th>-->
        <th data-options="field:'serverType',width:60">服务类型</th>
        <th data-options="field:'message',width:120">内容</th>
        <#--<th data-options="field:'keyword',width:50">关键字</th>-->
    <#--<th data-options="field:'state',width:30">状态</th>-->
    <#--<th data-options="field:'drop',width:50,align:'center'">操作</th>-->
        <#--<th data-options="field:'navigate',width:50,align:'center'">跟踪</th>-->
    </tr>
    </thead>
</table>
<script type="text/javascript">
    function loadAll() {
        var pager = $('#dg').datagrid({
            fitColumns: true,
            fit: true,
            loadFilter: function (data) {
                // alert(data);
                if (data != null && data.rows != null) {
                    for (var i = 0; i < data.rows.length; i++) {
                        var record = data.rows[i];
//                    console.log(record)
//                        var state = "";
//                        if(record.state == "0"){
//                           state = "未审核";
//                        }else if(record.state == "1"){
//                           state = "待审核";
//                        }else{
//                           state = "已审核";
//                        }
//                        record.state = state;
//                        var drop = "<a href='#' onclick='dropServer(\"" + record.ssid + "\")'>删除</a>";
//                        record.drop = drop;
                        //var servertype = record.serverType;
                        //record.state="<a href='#' onclick='setVtsState(\""+midLon+"\",\""+midLat+"\",\""+record.title+"\",\""+record.guid+"\",\""+record.isValid+"\")'>"+isValid+"</a>";
                        record.shipimei=record.shipPositionInfo.shipimei;
                        record.shipname=record.shipPositionInfo.ship.shipName;
                        record.navigate = "<a href='#' onclick='locationMap(\"" + record.shipPositionInfo.longitude+ "\",\"" + record.shipPositionInfo.latitude+ "\",\"" + record.shipPositionInfo.shipimei+ "\",\"" + record.shipPositionInfo.ship.shipName+ "\",\"" + record.shipPositionInfo.couese+ "\")'>" +
                                record.shipPositionInfo.ship.shipName +
                                "</a>";

                    }
                }
                return data;
            }
        })

        var page=$('#dg').datagrid('getPager');
        page.pagination({
            layout:['first','prev','next','last','refresh'],
            showRefresh:true
        });
    };	// get the pager of datagrid
    $(function () {
        loadAll();
        $(".btn-search").click(function () {
            $('#dg').datagrid("load",{
                keyword : $("#title").val()
            })
        })
    })

    function locationMap(lon,lat,shipimei,shipname,course) {
        if(lon!='null'&&lat!='null')
        {
            var trackShip={
                trackId:shipimei,
                type:"cyx"
            }
            window.parent.locMap(lon,lat,trackShip,shipname,course);
        }else{
            window.parent.layer.alert('无法追踪该船舶');
        }

    }
</script>


</body>
</html>